using NUnit.Framework;

namespace Solver
{
	/// <summary>
	/// How many letters would be needed to write all the numbers in words from 1 to 1000?
	/// </summary>
	public class Problem017 : SelfChecker, IProblem
	{
		public int Id
		{
			get { return 17; }
		}

		public string Solve()
		{
			const int s9 = 36;
			const int s19 = 106;
			const int w = 46;
			const int s99 = s19 + 10 * w + 8 * s9;
			const int lhundred = 7;
			const int s1000 = 11 + 10 * s99 + 99 * 9 * 3 + 100 * (9 * lhundred + s9);
			return s1000.ToString();
		}

		[Test]
		public override void Check()
		{
			Assert.AreEqual("21124", Solve());
		}
	}
}